cmake_minimum_required(VERSION 3.25)

project(lockit)

set(CMAKE_C_STANDARD 11)

add_executable(lockit
  src/lockit.c
  src/dpi.c
  src/lockit_randr.c
  src/unlock_indicator.c
  src/lockit_xcb.c
)

target_include_directories(lockit
  PRIVATE
  include
)

# pkg-config program
find_package(PkgConfig REQUIRED)

pkg_check_modules(xcb REQUIRED xcb)
pkg_check_modules(xcb-xkb REQUIRED xcb-xkb)
pkg_check_modules(xcb-xinerama REQUIRED xcb-xinerama)
pkg_check_modules(xcb-randr REQUIRED xcb-randr)
pkg_check_modules(xcb-image REQUIRED xcb-image)
pkg_check_modules(xcb-util REQUIRED xcb-util)
pkg_check_modules(xcb-xrm REQUIRED xcb-xrm)
pkg_check_modules(xkbcommon REQUIRED xkbcommon)
pkg_check_modules(xkbcommon-x11 REQUIRED xkbcommon-x11)
pkg_check_modules(cairo REQUIRED cairo)


target_include_directories(lockit
    PRIVATE
    ${xcb_INCLUDE_DIRS}
    ${xcb-xkb_INCLUDE_DIRS}
    ${xcb-xinerama_INCLUDE_DIRS}
    ${xcb-randr_INCLUDE_DIRS}
    ${xcb-image_INCLUDE_DIRS}
    ${xcb-util_INCLUDE_DIRS}
    ${xcb-xrm_INCLUDE_DIRS}
    ${xkbcommon_INCLUDE_DIRS}
    ${xkbcommon-x11_INCLUDE_DIRS}
    ${cairo_INCLUDE_DIRS}
)

target_link_libraries(lockit
    ${xcb_LIBRARIES}
    ${xcb-xkb_LIBRARIES}
    ${xcb-xinerama_LIBRARIES}
    ${xcb-randr_LIBRARIES}
    ${xcb-image_LIBRARIES}
    ${xcb-util_LIBRARIES}
    ${xcb-xrm_LIBRARIES}
    ${xkbcommon_LIBRARIES}
    ${xkbcommon-x11_LIBRARIES}
    ${cairo_LIBRARIES}
    # gcc builtin ldflags ?
    m
    rt
    # linux builtin ?
    pam
    # libev
    ev
    # linux pthread ?
    pthread
)